Skip to content

Conversation

@AlexGPlay
Copy link
Contributor

@AlexGPlay AlexGPlay commented Oct 31, 2025

Summary

Closes #240887

Right now if a background search has 0 searches it stays in the "In progress" state but that's not correct. If no searches are added to the background search it means that something went wrong. With this PR we will label as error the search sessions if they have 0 searches after being created for 30 seconds.

Before After
image image

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Unit or functional tests were updated or added to match the most common scenarios
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

@AlexGPlay AlexGPlay force-pushed the 240887-error-on-no-searches branch from dc32bc8 to 1534875 Compare October 31, 2025 10:26
// A session should is considered "new" for the first 30 seconds after creation. We need some arbitrary value here
// because if a sessions stays for too long with no searches assigned to it something happened and we should mark it as error.
// Some examples of possible issues: the browser is closed or in another tab the search requests are canceled.
const NEW_SESSION_THRESHOLD_SECONDS = 30;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

30 seconds is a totally arbitrary number, happy to change it to something else if it doesn't sound good

@AlexGPlay AlexGPlay self-assigned this Oct 31, 2025
@AlexGPlay AlexGPlay added release_note:skip Skip the PR/issue when compiling release notes Project:AsyncSearch Background search, partial results, async search services. Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// backport:version Backport to applied version labels v9.3.0 v9.2.1 labels Oct 31, 2025
@AlexGPlay AlexGPlay marked this pull request as ready for review October 31, 2025 12:15
@AlexGPlay AlexGPlay requested review from a team as code owners October 31, 2025 12:15
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@kertal kertal requested a review from lukasolson October 31, 2025 12:48
Copy link
Contributor

@lukasolson lukasolson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Image

@AlexGPlay AlexGPlay force-pushed the 240887-error-on-no-searches branch from 1534875 to b675544 Compare November 4, 2025 06:39
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

✅ unchanged

History

cc @AlexGPlay

@AlexGPlay AlexGPlay merged commit 131f1a0 into elastic:main Nov 5, 2025
12 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 9.2

https://github.com/elastic/kibana/actions/runs/19098479488

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 5, 2025
…astic#241411)

## Summary

Closes elastic#240887

Right now if a background search has 0 searches it stays in the "In
progress" state but that's not correct. If no searches are added to the
background search it means that something went wrong. With this PR we
will label as error the search sessions if they have 0 searches after
being created for 30 seconds.

| Before | After |
|--------|------|
| <img width="716" height="89" alt="image"
src="https://github.com/user-attachments/assets/1bb4b60a-20d3-488e-b4e9-9fd8cd4d0b24"
/> | <img width="675" height="88" alt="image"
src="https://github.com/user-attachments/assets/4befb6c0-5edb-4229-9919-e2b76ae90731"
/> |

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

(cherry picked from commit 131f1a0)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
9.2

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Nov 5, 2025
…es (#241411) (#241932)

# Backport

This will backport the following commits from `main` to `9.2`:
- [[Background search] Return error state when there are no searches
(#241411)](#241411)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Alejandro García
Parrondo","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-11-05T10:10:43Z","message":"[Background
search] Return error state when there are no searches (#241411)\n\n##
Summary\n\nCloses
https://github.com/elastic/kibana/issues/240887\n\nRight now if a
background search has 0 searches it stays in the \"In\nprogress\" state
but that's not correct. If no searches are added to the\nbackground
search it means that something went wrong. With this PR we\nwill label
as error the search sessions if they have 0 searches after\nbeing
created for 30 seconds.\n\n| Before | After |\n|--------|------|\n| <img
width=\"716\" height=\"89\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/1bb4b60a-20d3-488e-b4e9-9fd8cd4d0b24\"\n/>
| <img width=\"675\" height=\"88\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/4befb6c0-5edb-4229-9919-e2b76ae90731\"\n/>
|\n\n\n### Checklist\n\nCheck the PR satisfies following conditions.
\n\nReviewers should verify this PR satisfies this list as well.\n\n-
[x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*`
labels.","sha":"131f1a002666e1a3065dacc30754a519bce7a2cc","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Project:AsyncSearch","Team:DataDiscovery","backport:version","v9.3.0","v9.2.1"],"title":"[Background
search] Return error state when there are no
searches","number":241411,"url":"https://github.com/elastic/kibana/pull/241411","mergeCommit":{"message":"[Background
search] Return error state when there are no searches (#241411)\n\n##
Summary\n\nCloses
https://github.com/elastic/kibana/issues/240887\n\nRight now if a
background search has 0 searches it stays in the \"In\nprogress\" state
but that's not correct. If no searches are added to the\nbackground
search it means that something went wrong. With this PR we\nwill label
as error the search sessions if they have 0 searches after\nbeing
created for 30 seconds.\n\n| Before | After |\n|--------|------|\n| <img
width=\"716\" height=\"89\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/1bb4b60a-20d3-488e-b4e9-9fd8cd4d0b24\"\n/>
| <img width=\"675\" height=\"88\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/4befb6c0-5edb-4229-9919-e2b76ae90731\"\n/>
|\n\n\n### Checklist\n\nCheck the PR satisfies following conditions.
\n\nReviewers should verify this PR satisfies this list as well.\n\n-
[x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*`
labels.","sha":"131f1a002666e1a3065dacc30754a519bce7a2cc"}},"sourceBranch":"main","suggestedTargetBranches":["9.2"],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/241411","number":241411,"mergeCommit":{"message":"[Background
search] Return error state when there are no searches (#241411)\n\n##
Summary\n\nCloses
https://github.com/elastic/kibana/issues/240887\n\nRight now if a
background search has 0 searches it stays in the \"In\nprogress\" state
but that's not correct. If no searches are added to the\nbackground
search it means that something went wrong. With this PR we\nwill label
as error the search sessions if they have 0 searches after\nbeing
created for 30 seconds.\n\n| Before | After |\n|--------|------|\n| <img
width=\"716\" height=\"89\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/1bb4b60a-20d3-488e-b4e9-9fd8cd4d0b24\"\n/>
| <img width=\"675\" height=\"88\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/4befb6c0-5edb-4229-9919-e2b76ae90731\"\n/>
|\n\n\n### Checklist\n\nCheck the PR satisfies following conditions.
\n\nReviewers should verify this PR satisfies this list as well.\n\n-
[x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*`
labels.","sha":"131f1a002666e1a3065dacc30754a519bce7a2cc"}},{"branch":"9.2","label":"v9.2.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Alejandro García Parrondo <[email protected]>
wildemat pushed a commit to wildemat/kibana that referenced this pull request Nov 5, 2025
…astic#241411)

## Summary

Closes elastic#240887

Right now if a background search has 0 searches it stays in the "In
progress" state but that's not correct. If no searches are added to the
background search it means that something went wrong. With this PR we
will label as error the search sessions if they have 0 searches after
being created for 30 seconds.

| Before | After |
|--------|------|
| <img width="716" height="89" alt="image"
src="https://github.com/user-attachments/assets/1bb4b60a-20d3-488e-b4e9-9fd8cd4d0b24"
/> | <img width="675" height="88" alt="image"
src="https://github.com/user-attachments/assets/4befb6c0-5edb-4229-9919-e2b76ae90731"
/> |


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.
viduni94 pushed a commit to viduni94/kibana that referenced this pull request Nov 5, 2025
…astic#241411)

## Summary

Closes elastic#240887

Right now if a background search has 0 searches it stays in the "In
progress" state but that's not correct. If no searches are added to the
background search it means that something went wrong. With this PR we
will label as error the search sessions if they have 0 searches after
being created for 30 seconds.

| Before | After |
|--------|------|
| <img width="716" height="89" alt="image"
src="https://github.com/user-attachments/assets/1bb4b60a-20d3-488e-b4e9-9fd8cd4d0b24"
/> | <img width="675" height="88" alt="image"
src="https://github.com/user-attachments/assets/4befb6c0-5edb-4229-9919-e2b76ae90731"
/> |


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels Project:AsyncSearch Background search, partial results, async search services. release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// v9.2.1 v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Background search] No search requests in background search should be handled as an error case

4 participants